<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span class="hs-pragma">{-# LANGUAGE CPP, MagicHash #-}</span><span>
</span><span id="line-2"></span><span>
</span><span id="line-3"></span><span class="hs-comment">-- | Dynamically lookup up values from modules and loading them.</span><span>
</span><span id="line-4"></span><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">GHC.Runtime.Loader</span><span> </span><span class="hs-special">(</span><span>
</span><span id="line-5"></span><span>        </span><span class="annot"><a href="GHC.Runtime.Loader.html#initializePlugins"><span class="hs-identifier">initializePlugins</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-6"></span><span>        </span><span class="annot"><span class="hs-comment">-- * Loading plugins</span></span><span>
</span><span id="line-7"></span><span>        </span><span class="annot"><a href="GHC.Runtime.Loader.html#loadFrontendPlugin"><span class="hs-identifier">loadFrontendPlugin</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-8"></span><span>
</span><span id="line-9"></span><span>        </span><span class="annot"><span class="hs-comment">-- * Force loading information</span></span><span>
</span><span id="line-10"></span><span>        </span><span class="annot"><a href="GHC.Runtime.Loader.html#forceLoadModuleInterfaces"><span class="hs-identifier">forceLoadModuleInterfaces</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-11"></span><span>        </span><span class="annot"><a href="GHC.Runtime.Loader.html#forceLoadNameModuleInterface"><span class="hs-identifier">forceLoadNameModuleInterface</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-12"></span><span>        </span><span class="annot"><a href="GHC.Runtime.Loader.html#forceLoadTyCon"><span class="hs-identifier">forceLoadTyCon</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-13"></span><span>
</span><span id="line-14"></span><span>        </span><span class="annot"><span class="hs-comment">-- * Finding names</span></span><span>
</span><span id="line-15"></span><span>        </span><span class="annot"><a href="GHC.Runtime.Loader.html#lookupRdrNameInModuleForPlugins"><span class="hs-identifier">lookupRdrNameInModuleForPlugins</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-16"></span><span>
</span><span id="line-17"></span><span>        </span><span class="annot"><span class="hs-comment">-- * Loading values</span></span><span>
</span><span id="line-18"></span><span>        </span><span class="annot"><a href="GHC.Runtime.Loader.html#getValueSafely"><span class="hs-identifier">getValueSafely</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-19"></span><span>        </span><span class="annot"><a href="GHC.Runtime.Loader.html#getHValueSafely"><span class="hs-identifier">getHValueSafely</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-20"></span><span>        </span><span class="annot"><a href="GHC.Runtime.Loader.html#lessUnsafeCoerce"><span class="hs-identifier">lessUnsafeCoerce</span></a></span><span>
</span><span id="line-21"></span><span>    </span><span class="hs-special">)</span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-22"></span><span>
</span><span id="line-23"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Prelude.html"><span class="hs-identifier">GHC.Prelude</span></a></span><span>
</span><span id="line-24"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html"><span class="hs-identifier">GHC.Driver.Session</span></a></span><span>
</span><span id="line-25"></span><span>
</span><span id="line-26"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Runtime.Linker.html"><span class="hs-identifier">GHC.Runtime.Linker</span></a></span><span>      </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Runtime.Linker.html#linkModule"><span class="hs-identifier">linkModule</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Runtime.Linker.html#getHValue"><span class="hs-identifier">getHValue</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-27"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Runtime.Interpreter.html"><span class="hs-identifier">GHC.Runtime.Interpreter</span></a></span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Runtime.Interpreter.html#wormhole"><span class="hs-identifier">wormhole</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Runtime.Interpreter.html#withInterp"><span class="hs-identifier">withInterp</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-28"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Runtime.Interpreter.Types.html"><span class="hs-identifier">GHC.Runtime.Interpreter.Types</span></a></span><span>
</span><span id="line-29"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html"><span class="hs-identifier">GHC.Types.SrcLoc</span></a></span><span>        </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html#noSrcSpan"><span class="hs-identifier">noSrcSpan</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-30"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Driver.Finder.html"><span class="hs-identifier">GHC.Driver.Finder</span></a></span><span>       </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Driver.Finder.html#findPluginModule"><span class="hs-identifier">findPluginModule</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Driver.Finder.html#cannotFindModule"><span class="hs-identifier">cannotFindModule</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-31"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.Monad.html"><span class="hs-identifier">GHC.Tc.Utils.Monad</span></a></span><span>      </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.Monad.html#initTcInteractive"><span class="hs-identifier">initTcInteractive</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Tc.Utils.Monad.html#initIfaceTcRn"><span class="hs-identifier">initIfaceTcRn</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-32"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Iface.Load.html"><span class="hs-identifier">GHC.Iface.Load</span></a></span><span>          </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Iface.Load.html#loadPluginInterface"><span class="hs-identifier">loadPluginInterface</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-33"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Name.Reader.html"><span class="hs-identifier">GHC.Types.Name.Reader</span></a></span><span>   </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Types.Name.Reader.html#RdrName"><span class="hs-identifier">RdrName</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Name.Reader.html#ImportSpec"><span class="hs-identifier">ImportSpec</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Name.Reader.html#ImpDeclSpec"><span class="hs-identifier">ImpDeclSpec</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span>
</span><span id="line-34"></span><span>                               </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Name.Reader.html#ImpItemSpec"><span class="hs-identifier">ImpItemSpec</span></a></span><span class="hs-special">(</span><span class="hs-glyph">..</span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Name.Reader.html#mkGlobalRdrEnv"><span class="hs-identifier">mkGlobalRdrEnv</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Name.Reader.html#lookupGRE_RdrName"><span class="hs-identifier">lookupGRE_RdrName</span></a></span><span>
</span><span id="line-35"></span><span>                               </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Name.Reader.html#gre_name"><span class="hs-identifier">gre_name</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Name.Reader.html#mkRdrQual"><span class="hs-identifier">mkRdrQual</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-36"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Name.Occurrence.html"><span class="hs-identifier">GHC.Types.Name.Occurrence</span></a></span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Types.Name.Occurrence.html#OccName"><span class="hs-identifier">OccName</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Name.Occurrence.html#mkVarOcc"><span class="hs-identifier">mkVarOcc</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-37"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Rename.Names.html"><span class="hs-identifier">GHC.Rename.Names</span></a></span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Types.Name.Reader.html#gresFromAvails"><span class="hs-identifier">gresFromAvails</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-38"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Driver.Plugins.html"><span class="hs-identifier">GHC.Driver.Plugins</span></a></span><span>
</span><span id="line-39"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Builtin.Names.html"><span class="hs-identifier">GHC.Builtin.Names</span></a></span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Builtin.Names.html#pluginTyConName"><span class="hs-identifier">pluginTyConName</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Builtin.Names.html#frontendPluginTyConName"><span class="hs-identifier">frontendPluginTyConName</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-40"></span><span>
</span><span id="line-41"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Driver.Types.html"><span class="hs-identifier">GHC.Driver.Types</span></a></span><span>
</span><span id="line-42"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../ghci/src/GHCi.RemoteTypes.html#"><span class="hs-identifier">GHCi.RemoteTypes</span></a></span><span>  </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="../../ghci/src/GHCi.RemoteTypes.html#HValue"><span class="hs-identifier">HValue</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-43"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.Type.html"><span class="hs-identifier">GHC.Core.Type</span></a></span><span>     </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier">Type</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.Type.html#eqType"><span class="hs-identifier">eqType</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#mkTyConTy"><span class="hs-identifier">mkTyConTy</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-44"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Ppr.html"><span class="hs-identifier">GHC.Core.TyCo.Ppr</span></a></span><span> </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#pprTyThingCategory"><span class="hs-identifier">pprTyThingCategory</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-45"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Core.TyCon.html"><span class="hs-identifier">GHC.Core.TyCon</span></a></span><span>    </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Core.TyCon.html#TyCon"><span class="hs-identifier">TyCon</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-46"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Name.html"><span class="hs-identifier">GHC.Types.Name</span></a></span><span>    </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Types.Name.html#Name"><span class="hs-identifier">Name</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.Name.html#nameModule_maybe"><span class="hs-identifier">nameModule_maybe</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-47"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Id.html"><span class="hs-identifier">GHC.Types.Id</span></a></span><span>      </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Types.Id.html#idType"><span class="hs-identifier">idType</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-48"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Unit.Module.html"><span class="hs-identifier">GHC.Unit.Module</span></a></span><span>   </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Unit.Types.html#Module"><span class="hs-identifier">Module</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Unit.Module.Name.html#ModuleName"><span class="hs-identifier">ModuleName</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-49"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Utils.Panic.html"><span class="hs-identifier">GHC.Utils.Panic</span></a></span><span>
</span><span id="line-50"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Data.FastString.html"><span class="hs-identifier">GHC.Data.FastString</span></a></span><span>
</span><span id="line-51"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Utils.Error.html"><span class="hs-identifier">GHC.Utils.Error</span></a></span><span>
</span><span id="line-52"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html"><span class="hs-identifier">GHC.Utils.Outputable</span></a></span><span>
</span><span id="line-53"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Utils.Exception.html"><span class="hs-identifier">GHC.Utils.Exception</span></a></span><span>
</span><span id="line-54"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Driver.Hooks.html"><span class="hs-identifier">GHC.Driver.Hooks</span></a></span><span>
</span><span id="line-55"></span><span>
</span><span id="line-56"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Control.Monad.html#"><span class="hs-identifier">Control.Monad</span></a></span><span>     </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="../../base/src/Control.Monad.html#unless"><span class="hs-identifier">unless</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-57"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Data.Maybe.html#"><span class="hs-identifier">Data.Maybe</span></a></span><span>        </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="../../base/src/Data.Maybe.html#mapMaybe"><span class="hs-identifier">mapMaybe</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-58"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Unsafe.Coerce.html#"><span class="hs-identifier">Unsafe.Coerce</span></a></span><span>     </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="../../base/src/Unsafe.Coerce.html#unsafeCoerce"><span class="hs-identifier">unsafeCoerce</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-59"></span><span>
</span><span id="line-60"></span><span class="hs-comment">-- | Loads the plugins specified in the pluginModNames field of the dynamic</span><span>
</span><span id="line-61"></span><span class="hs-comment">-- flags. Should be called after command line arguments are parsed, but before</span><span>
</span><span id="line-62"></span><span class="hs-comment">-- actual compilation starts. Idempotent operation. Should be re-called if</span><span>
</span><span id="line-63"></span><span class="hs-comment">-- pluginModNames or pluginModNameOpts changes.</span><span>
</span><span id="line-64"></span><span class="annot"><a href="GHC.Runtime.Loader.html#initializePlugins"><span class="hs-identifier hs-type">initializePlugins</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Types.html#HscEnv"><span class="hs-identifier hs-type">HscEnv</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html#DynFlags"><span class="hs-identifier hs-type">DynFlags</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="annot"><a href="GHC.Driver.Session.html#DynFlags"><span class="hs-identifier hs-type">DynFlags</span></a></span><span>
</span><span id="line-65"></span><span id="initializePlugins"><span class="annot"><span class="annottext">initializePlugins :: HscEnv -&gt; DynFlags -&gt; IO DynFlags
</span><a href="GHC.Runtime.Loader.html#initializePlugins"><span class="hs-identifier hs-var hs-var">initializePlugins</span></a></span></span><span> </span><span id="local-6989586621681178757"><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681178757"><span class="hs-identifier hs-var">hsc_env</span></a></span></span><span> </span><span id="local-6989586621681178756"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681178756"><span class="hs-identifier hs-var">df</span></a></span></span><span>
</span><span id="line-66"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">(LoadedPlugin -&gt; ModuleName) -&gt; [LoadedPlugin] -&gt; [ModuleName]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">LoadedPlugin -&gt; ModuleName
</span><a href="GHC.Driver.Plugins.html#lpModuleName"><span class="hs-identifier hs-var">lpModuleName</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DynFlags -&gt; [LoadedPlugin]
</span><a href="GHC.Driver.Session.html#cachedPlugins"><span class="hs-identifier hs-var hs-var">cachedPlugins</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681178756"><span class="hs-identifier hs-var">df</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-67"></span><span>         </span><span class="annot"><span class="annottext">[ModuleName] -&gt; [ModuleName] -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; [ModuleName]
</span><a href="GHC.Driver.Session.html#pluginModNames"><span class="hs-identifier hs-var hs-var">pluginModNames</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681178756"><span class="hs-identifier hs-var">df</span></a></span><span> </span><span class="hs-comment">-- plugins not changed</span><span>
</span><span id="line-68"></span><span>     </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span> </span><span class="annot"><span class="annottext">(LoadedPlugin -&gt; Bool) -&gt; [LoadedPlugin] -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; (a -&gt; Bool) -&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#all"><span class="hs-identifier hs-var">all</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span id="local-6989586621681178750"><span class="annot"><span class="annottext">LoadedPlugin
</span><a href="#local-6989586621681178750"><span class="hs-identifier hs-var">p</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">PluginWithArgs -&gt; [CommandLineOption]
</span><a href="GHC.Driver.Plugins.html#paArguments"><span class="hs-identifier hs-var hs-var">paArguments</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">LoadedPlugin -&gt; PluginWithArgs
</span><a href="GHC.Driver.Plugins.html#lpPlugin"><span class="hs-identifier hs-var hs-var">lpPlugin</span></a></span><span> </span><span class="annot"><span class="annottext">LoadedPlugin
</span><a href="#local-6989586621681178750"><span class="hs-identifier hs-var">p</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-69"></span><span>                       </span><span class="annot"><span class="annottext">[CommandLineOption] -&gt; [CommandLineOption] -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">LoadedPlugin
-&gt; [(ModuleName, CommandLineOption)] -&gt; [CommandLineOption]
forall {b}. LoadedPlugin -&gt; [(ModuleName, b)] -&gt; [b]
</span><a href="#local-6989586621681178747"><span class="hs-identifier hs-var">argumentsForPlugin</span></a></span><span> </span><span class="annot"><span class="annottext">LoadedPlugin
</span><a href="#local-6989586621681178750"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DynFlags -&gt; [(ModuleName, CommandLineOption)]
</span><a href="GHC.Driver.Session.html#pluginModNameOpts"><span class="hs-identifier hs-var hs-var">pluginModNameOpts</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681178756"><span class="hs-identifier hs-var">df</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-70"></span><span>            </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DynFlags -&gt; [LoadedPlugin]
</span><a href="GHC.Driver.Session.html#cachedPlugins"><span class="hs-identifier hs-var hs-var">cachedPlugins</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681178756"><span class="hs-identifier hs-var">df</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-comment">-- arguments not changed</span><span>
</span><span id="line-71"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; IO DynFlags
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681178756"><span class="hs-identifier hs-var">df</span></a></span><span> </span><span class="hs-comment">-- no need to reload plugins</span><span>
</span><span id="line-72"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-73"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span id="local-6989586621681178745"><span class="annot"><span class="annottext">[LoadedPlugin]
</span><a href="#local-6989586621681178745"><span class="hs-identifier hs-var">loadedPlugins</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">HscEnv -&gt; IO [LoadedPlugin]
</span><a href="GHC.Runtime.Loader.html#loadPlugins"><span class="hs-identifier hs-var">loadPlugins</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681178757"><span class="hs-identifier hs-var">hsc_env</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">hsc_dflags :: DynFlags
</span><a href="GHC.Driver.Types.html#hsc_dflags"><span class="hs-identifier hs-var">hsc_dflags</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681178756"><span class="hs-identifier hs-var">df</span></a></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-74"></span><span>       </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681178742"><span class="annot"><span class="annottext">df' :: DynFlags
</span><a href="#local-6989586621681178742"><span class="hs-identifier hs-var hs-var">df'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681178756"><span class="hs-identifier hs-var">df</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">cachedPlugins :: [LoadedPlugin]
</span><a href="GHC.Driver.Session.html#cachedPlugins"><span class="hs-identifier hs-var">cachedPlugins</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[LoadedPlugin]
</span><a href="#local-6989586621681178745"><span class="hs-identifier hs-var">loadedPlugins</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-75"></span><span>       </span><span id="local-6989586621681178741"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681178741"><span class="hs-identifier hs-var">df''</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; PluginOperation IO DynFlags -&gt; DynFlags -&gt; IO DynFlags
forall (m :: * -&gt; *) a.
Monad m =&gt;
DynFlags -&gt; PluginOperation m a -&gt; a -&gt; m a
</span><a href="GHC.Driver.Plugins.html#withPlugins"><span class="hs-identifier hs-var">withPlugins</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681178742"><span class="hs-identifier hs-var">df'</span></a></span><span> </span><span class="annot"><span class="annottext">PluginOperation IO DynFlags
</span><a href="#local-6989586621681178739"><span class="hs-identifier hs-var">runDflagsPlugin</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681178742"><span class="hs-identifier hs-var">df'</span></a></span><span>
</span><span id="line-76"></span><span>       </span><span class="annot"><span class="annottext">DynFlags -&gt; IO DynFlags
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681178741"><span class="hs-identifier hs-var">df''</span></a></span><span>
</span><span id="line-77"></span><span>
</span><span id="line-78"></span><span>  </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621681178747"><span class="annot"><span class="annottext">argumentsForPlugin :: LoadedPlugin -&gt; [(ModuleName, b)] -&gt; [b]
</span><a href="#local-6989586621681178747"><span class="hs-identifier hs-var hs-var">argumentsForPlugin</span></a></span></span><span> </span><span id="local-6989586621681178737"><span class="annot"><span class="annottext">LoadedPlugin
</span><a href="#local-6989586621681178737"><span class="hs-identifier hs-var">p</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">((ModuleName, b) -&gt; b) -&gt; [(ModuleName, b)] -&gt; [b]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">(ModuleName, b) -&gt; b
forall a b. (a, b) -&gt; b
</span><a href="../../base/src/Data.Tuple.html#snd"><span class="hs-identifier hs-var">snd</span></a></span><span> </span><span class="annot"><span class="annottext">([(ModuleName, b)] -&gt; [b])
-&gt; ([(ModuleName, b)] -&gt; [(ModuleName, b)])
-&gt; [(ModuleName, b)]
-&gt; [b]
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">((ModuleName, b) -&gt; Bool) -&gt; [(ModuleName, b)] -&gt; [(ModuleName, b)]
forall a. (a -&gt; Bool) -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.List.html#filter"><span class="hs-identifier hs-var">filter</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="annot"><span class="annottext">ModuleName -&gt; ModuleName -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">LoadedPlugin -&gt; ModuleName
</span><a href="GHC.Driver.Plugins.html#lpModuleName"><span class="hs-identifier hs-var">lpModuleName</span></a></span><span> </span><span class="annot"><span class="annottext">LoadedPlugin
</span><a href="#local-6989586621681178737"><span class="hs-identifier hs-var">p</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(ModuleName -&gt; Bool)
-&gt; ((ModuleName, b) -&gt; ModuleName) -&gt; (ModuleName, b) -&gt; Bool
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">(ModuleName, b) -&gt; ModuleName
forall a b. (a, b) -&gt; a
</span><a href="../../base/src/Data.Tuple.html#fst"><span class="hs-identifier hs-var">fst</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-79"></span><span>        </span><span id="local-6989586621681178739"><span class="annot"><span class="annottext">runDflagsPlugin :: PluginOperation IO DynFlags
</span><a href="#local-6989586621681178739"><span class="hs-identifier hs-var hs-var">runDflagsPlugin</span></a></span></span><span> </span><span id="local-6989586621681178735"><span class="annot"><span class="annottext">Plugin
</span><a href="#local-6989586621681178735"><span class="hs-identifier hs-var">p</span></a></span></span><span> </span><span id="local-6989586621681178734"><span class="annot"><span class="annottext">[CommandLineOption]
</span><a href="#local-6989586621681178734"><span class="hs-identifier hs-var">opts</span></a></span></span><span> </span><span id="local-6989586621681178733"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681178733"><span class="hs-identifier hs-var">dynflags</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">PluginOperation IO DynFlags
</span><a href="GHC.Driver.Plugins.html#dynflagsPlugin"><span class="hs-identifier hs-var hs-var">dynflagsPlugin</span></a></span><span> </span><span class="annot"><span class="annottext">Plugin
</span><a href="#local-6989586621681178735"><span class="hs-identifier hs-var">p</span></a></span><span> </span><span class="annot"><span class="annottext">[CommandLineOption]
</span><a href="#local-6989586621681178734"><span class="hs-identifier hs-var">opts</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681178733"><span class="hs-identifier hs-var">dynflags</span></a></span><span>
</span><span id="line-80"></span><span>
</span><span id="line-81"></span><span class="annot"><a href="GHC.Runtime.Loader.html#loadPlugins"><span class="hs-identifier hs-type">loadPlugins</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Types.html#HscEnv"><span class="hs-identifier hs-type">HscEnv</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Driver.Plugins.html#LoadedPlugin"><span class="hs-identifier hs-type">LoadedPlugin</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-82"></span><span id="loadPlugins"><span class="annot"><span class="annottext">loadPlugins :: HscEnv -&gt; IO [LoadedPlugin]
</span><a href="GHC.Runtime.Loader.html#loadPlugins"><span class="hs-identifier hs-var hs-var">loadPlugins</span></a></span></span><span> </span><span id="local-6989586621681178731"><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681178731"><span class="hs-identifier hs-var">hsc_env</span></a></span></span><span>
</span><span id="line-83"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; IO () -&gt; IO ()
forall (f :: * -&gt; *). Applicative f =&gt; Bool -&gt; f () -&gt; f ()
</span><a href="../../base/src/Control.Monad.html#unless"><span class="hs-identifier hs-var">unless</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[ModuleName] -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#null"><span class="hs-identifier hs-var">null</span></a></span><span> </span><span class="annot"><span class="annottext">[ModuleName]
</span><a href="#local-6989586621681178729"><span class="hs-identifier hs-var">to_load</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(IO () -&gt; IO ()) -&gt; IO () -&gt; IO ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-84"></span><span>           </span><span class="annot"><span class="annottext">HscEnv -&gt; IO ()
</span><a href="GHC.Runtime.Loader.html#checkExternalInterpreter"><span class="hs-identifier hs-var">checkExternalInterpreter</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681178731"><span class="hs-identifier hs-var">hsc_env</span></a></span><span>
</span><span id="line-85"></span><span>       </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681178727"><span class="annot"><span class="annottext">[(Plugin, ModIface)]
</span><a href="#local-6989586621681178727"><span class="hs-identifier hs-var">plugins</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">(ModuleName -&gt; IO (Plugin, ModIface))
-&gt; [ModuleName] -&gt; IO [(Plugin, ModIface)]
forall (t :: * -&gt; *) (m :: * -&gt; *) a b.
(Traversable t, Monad m) =&gt;
(a -&gt; m b) -&gt; t a -&gt; m (t b)
</span><a href="../../base/src/Data.Traversable.html#mapM"><span class="hs-identifier hs-var">mapM</span></a></span><span> </span><span class="annot"><span class="annottext">ModuleName -&gt; IO (Plugin, ModIface)
forall {a}. ModuleName -&gt; IO (a, ModIface)
</span><a href="#local-6989586621681178725"><span class="hs-identifier hs-var">loadPlugin</span></a></span><span> </span><span class="annot"><span class="annottext">[ModuleName]
</span><a href="#local-6989586621681178729"><span class="hs-identifier hs-var">to_load</span></a></span><span>
</span><span id="line-86"></span><span>       </span><span class="hs-special">;</span><span> </span><span class="annot"><span class="annottext">[LoadedPlugin] -&gt; IO [LoadedPlugin]
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">([LoadedPlugin] -&gt; IO [LoadedPlugin])
-&gt; [LoadedPlugin] -&gt; IO [LoadedPlugin]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">(ModuleName -&gt; (Plugin, ModIface) -&gt; LoadedPlugin)
-&gt; [ModuleName] -&gt; [(Plugin, ModIface)] -&gt; [LoadedPlugin]
forall a b c. (a -&gt; b -&gt; c) -&gt; [a] -&gt; [b] -&gt; [c]
</span><a href="../../base/src/GHC.List.html#zipWith"><span class="hs-identifier hs-var">zipWith</span></a></span><span> </span><span class="annot"><span class="annottext">ModuleName -&gt; (Plugin, ModIface) -&gt; LoadedPlugin
</span><a href="#local-6989586621681178723"><span class="hs-identifier hs-var">attachOptions</span></a></span><span> </span><span class="annot"><span class="annottext">[ModuleName]
</span><a href="#local-6989586621681178729"><span class="hs-identifier hs-var">to_load</span></a></span><span> </span><span class="annot"><span class="annottext">[(Plugin, ModIface)]
</span><a href="#local-6989586621681178727"><span class="hs-identifier hs-var">plugins</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-87"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-88"></span><span>    </span><span id="local-6989586621681178722"><span class="annot"><span class="annottext">dflags :: DynFlags
</span><a href="#local-6989586621681178722"><span class="hs-identifier hs-var hs-var">dflags</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HscEnv -&gt; DynFlags
</span><a href="GHC.Driver.Types.html#hsc_dflags"><span class="hs-identifier hs-var hs-var">hsc_dflags</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681178731"><span class="hs-identifier hs-var">hsc_env</span></a></span><span>
</span><span id="line-89"></span><span>    </span><span id="local-6989586621681178729"><span class="annot"><span class="annottext">to_load :: [ModuleName]
</span><a href="#local-6989586621681178729"><span class="hs-identifier hs-var hs-var">to_load</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; [ModuleName]
</span><a href="GHC.Driver.Session.html#pluginModNames"><span class="hs-identifier hs-var hs-var">pluginModNames</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681178722"><span class="hs-identifier hs-var">dflags</span></a></span><span>
</span><span id="line-90"></span><span>
</span><span id="line-91"></span><span>    </span><span id="local-6989586621681178723"><span class="annot"><span class="annottext">attachOptions :: ModuleName -&gt; (Plugin, ModIface) -&gt; LoadedPlugin
</span><a href="#local-6989586621681178723"><span class="hs-identifier hs-var hs-var">attachOptions</span></a></span></span><span> </span><span id="local-6989586621681178721"><span class="annot"><span class="annottext">ModuleName
</span><a href="#local-6989586621681178721"><span class="hs-identifier hs-var">mod_nm</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621681178720"><span class="annot"><span class="annottext">Plugin
</span><a href="#local-6989586621681178720"><span class="hs-identifier hs-var">plug</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681178719"><span class="annot"><span class="annottext">ModIface
</span><a href="#local-6989586621681178719"><span class="hs-identifier hs-var">mod</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-92"></span><span>        </span><span class="annot"><span class="annottext">PluginWithArgs -&gt; ModIface -&gt; LoadedPlugin
</span><a href="GHC.Driver.Plugins.html#LoadedPlugin"><span class="hs-identifier hs-var">LoadedPlugin</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Plugin -&gt; [CommandLineOption] -&gt; PluginWithArgs
</span><a href="GHC.Driver.Plugins.html#PluginWithArgs"><span class="hs-identifier hs-var">PluginWithArgs</span></a></span><span> </span><span class="annot"><span class="annottext">Plugin
</span><a href="#local-6989586621681178720"><span class="hs-identifier hs-var">plug</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[CommandLineOption] -&gt; [CommandLineOption]
forall a. [a] -&gt; [a]
</span><a href="../../base/src/GHC.List.html#reverse"><span class="hs-identifier hs-var">reverse</span></a></span><span> </span><span class="annot"><span class="annottext">[CommandLineOption]
</span><a href="#local-6989586621681178715"><span class="hs-identifier hs-var">options</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">ModIface
</span><a href="#local-6989586621681178719"><span class="hs-identifier hs-var">mod</span></a></span><span>
</span><span id="line-93"></span><span>      </span><span class="hs-keyword">where</span><span>
</span><span id="line-94"></span><span>        </span><span id="local-6989586621681178715"><span class="annot"><span class="annottext">options :: [CommandLineOption]
</span><a href="#local-6989586621681178715"><span class="hs-identifier hs-var hs-var">options</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">CommandLineOption
</span><a href="#local-6989586621681178713"><span class="hs-identifier hs-var">option</span></a></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="hs-special">(</span><span id="local-6989586621681178712"><span class="annot"><span class="annottext">ModuleName
</span><a href="#local-6989586621681178712"><span class="hs-identifier hs-var">opt_mod_nm</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681178713"><span class="annot"><span class="annottext">CommandLineOption
</span><a href="#local-6989586621681178713"><span class="hs-identifier hs-var">option</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; [(ModuleName, CommandLineOption)]
</span><a href="GHC.Driver.Session.html#pluginModNameOpts"><span class="hs-identifier hs-var hs-var">pluginModNameOpts</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681178722"><span class="hs-identifier hs-var">dflags</span></a></span><span>
</span><span id="line-95"></span><span>                            </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ModuleName
</span><a href="#local-6989586621681178712"><span class="hs-identifier hs-var">opt_mod_nm</span></a></span><span> </span><span class="annot"><span class="annottext">ModuleName -&gt; ModuleName -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">ModuleName
</span><a href="#local-6989586621681178721"><span class="hs-identifier hs-var">mod_nm</span></a></span><span> </span><span class="hs-special">]</span><span>
</span><span id="line-96"></span><span>    </span><span id="local-6989586621681178725"><span class="annot"><span class="annottext">loadPlugin :: ModuleName -&gt; IO (a, ModIface)
</span><a href="#local-6989586621681178725"><span class="hs-identifier hs-var hs-var">loadPlugin</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">OccName -&gt; Name -&gt; HscEnv -&gt; ModuleName -&gt; IO (a, ModIface)
forall a.
OccName -&gt; Name -&gt; HscEnv -&gt; ModuleName -&gt; IO (a, ModIface)
</span><a href="GHC.Runtime.Loader.html#loadPlugin%27"><span class="hs-identifier hs-var">loadPlugin'</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CommandLineOption -&gt; OccName
</span><a href="GHC.Types.Name.Occurrence.html#mkVarOcc"><span class="hs-identifier hs-var">mkVarOcc</span></a></span><span> </span><span class="annot"><span class="annottext">CommandLineOption
</span><span class="hs-string">&quot;plugin&quot;</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="GHC.Builtin.Names.html#pluginTyConName"><span class="hs-identifier hs-var">pluginTyConName</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681178731"><span class="hs-identifier hs-var">hsc_env</span></a></span><span>
</span><span id="line-97"></span><span>
</span><span id="line-98"></span><span>
</span><span id="line-99"></span><span class="annot"><a href="GHC.Runtime.Loader.html#loadFrontendPlugin"><span class="hs-identifier hs-type">loadFrontendPlugin</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Types.html#HscEnv"><span class="hs-identifier hs-type">HscEnv</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Unit.Module.Name.html#ModuleName"><span class="hs-identifier hs-type">ModuleName</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="annot"><a href="GHC.Driver.Plugins.html#FrontendPlugin"><span class="hs-identifier hs-type">FrontendPlugin</span></a></span><span>
</span><span id="line-100"></span><span id="loadFrontendPlugin"><span class="annot"><span class="annottext">loadFrontendPlugin :: HscEnv -&gt; ModuleName -&gt; IO FrontendPlugin
</span><a href="GHC.Runtime.Loader.html#loadFrontendPlugin"><span class="hs-identifier hs-var hs-var">loadFrontendPlugin</span></a></span></span><span> </span><span id="local-6989586621681178710"><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681178710"><span class="hs-identifier hs-var">hsc_env</span></a></span></span><span> </span><span id="local-6989586621681178709"><span class="annot"><span class="annottext">ModuleName
</span><a href="#local-6989586621681178709"><span class="hs-identifier hs-var">mod_name</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-101"></span><span>    </span><span class="annot"><span class="annottext">HscEnv -&gt; IO ()
</span><a href="GHC.Runtime.Loader.html#checkExternalInterpreter"><span class="hs-identifier hs-var">checkExternalInterpreter</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681178710"><span class="hs-identifier hs-var">hsc_env</span></a></span><span>
</span><span id="line-102"></span><span>    </span><span class="annot"><span class="annottext">(FrontendPlugin, ModIface) -&gt; FrontendPlugin
forall a b. (a, b) -&gt; a
</span><a href="../../base/src/Data.Tuple.html#fst"><span class="hs-identifier hs-var">fst</span></a></span><span> </span><span class="annot"><span class="annottext">((FrontendPlugin, ModIface) -&gt; FrontendPlugin)
-&gt; IO (FrontendPlugin, ModIface) -&gt; IO FrontendPlugin
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/Data.Functor.html#%3C%24%3E"><span class="hs-operator hs-var">&lt;$&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">OccName
-&gt; Name -&gt; HscEnv -&gt; ModuleName -&gt; IO (FrontendPlugin, ModIface)
forall a.
OccName -&gt; Name -&gt; HscEnv -&gt; ModuleName -&gt; IO (a, ModIface)
</span><a href="GHC.Runtime.Loader.html#loadPlugin%27"><span class="hs-identifier hs-var">loadPlugin'</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CommandLineOption -&gt; OccName
</span><a href="GHC.Types.Name.Occurrence.html#mkVarOcc"><span class="hs-identifier hs-var">mkVarOcc</span></a></span><span> </span><span class="annot"><span class="annottext">CommandLineOption
</span><span class="hs-string">&quot;frontendPlugin&quot;</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="GHC.Builtin.Names.html#frontendPluginTyConName"><span class="hs-identifier hs-var">frontendPluginTyConName</span></a></span><span>
</span><span id="line-103"></span><span>                </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681178710"><span class="hs-identifier hs-var">hsc_env</span></a></span><span> </span><span class="annot"><span class="annottext">ModuleName
</span><a href="#local-6989586621681178709"><span class="hs-identifier hs-var">mod_name</span></a></span><span>
</span><span id="line-104"></span><span>
</span><span id="line-105"></span><span class="hs-comment">-- #14335</span><span>
</span><span id="line-106"></span><span class="annot"><a href="GHC.Runtime.Loader.html#checkExternalInterpreter"><span class="hs-identifier hs-type">checkExternalInterpreter</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Types.html#HscEnv"><span class="hs-identifier hs-type">HscEnv</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-107"></span><span id="checkExternalInterpreter"><span class="annot"><span class="annottext">checkExternalInterpreter :: HscEnv -&gt; IO ()
</span><a href="GHC.Runtime.Loader.html#checkExternalInterpreter"><span class="hs-identifier hs-var hs-var">checkExternalInterpreter</span></a></span></span><span> </span><span id="local-6989586621681178707"><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681178707"><span class="hs-identifier hs-var">hsc_env</span></a></span></span><span>
</span><span id="line-108"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Runtime.Interpreter.Types.html#ExternalInterp"><span class="hs-identifier hs-type">ExternalInterp</span></a></span><span> </span><span class="hs-special">{</span><span class="hs-special">}</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">HscEnv -&gt; Maybe Interp
</span><a href="GHC.Driver.Types.html#hsc_interp"><span class="hs-identifier hs-var hs-var">hsc_interp</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681178707"><span class="hs-identifier hs-var">hsc_env</span></a></span><span>
</span><span id="line-109"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">GhcException -&gt; IO ()
forall e a. Exception e =&gt; e -&gt; IO a
</span><a href="../../base/src/GHC.IO.html#throwIO"><span class="hs-identifier hs-var">throwIO</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CommandLineOption -&gt; GhcException
</span><a href="GHC.Utils.Panic.html#InstallationError"><span class="hs-identifier hs-var">InstallationError</span></a></span><span> </span><span class="annot"><span class="annottext">CommandLineOption
</span><span class="hs-string">&quot;Plugins require -fno-external-interpreter&quot;</span></span><span class="hs-special">)</span><span>
</span><span id="line-110"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span>
</span><span id="line-111"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">() -&gt; IO ()
forall (f :: * -&gt; *) a. Applicative f =&gt; a -&gt; f a
</span><a href="../../base/src/GHC.Base.html#pure"><span class="hs-identifier hs-var">pure</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-112"></span><span>
</span><span id="line-113"></span><span id="local-6989586621681178922"><span class="annot"><a href="GHC.Runtime.Loader.html#loadPlugin%27"><span class="hs-identifier hs-type">loadPlugin'</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Name.Occurrence.html#OccName"><span class="hs-identifier hs-type">OccName</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Name.html#Name"><span class="hs-identifier hs-type">Name</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Driver.Types.html#HscEnv"><span class="hs-identifier hs-type">HscEnv</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Unit.Module.Name.html#ModuleName"><span class="hs-identifier hs-type">ModuleName</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="#local-6989586621681178922"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Driver.Types.html#ModIface"><span class="hs-identifier hs-type">ModIface</span></a></span><span class="hs-special">)</span></span><span>
</span><span id="line-114"></span><span id="loadPlugin%27"><span class="annot"><span class="annottext">loadPlugin' :: forall a.
OccName -&gt; Name -&gt; HscEnv -&gt; ModuleName -&gt; IO (a, ModIface)
</span><a href="GHC.Runtime.Loader.html#loadPlugin%27"><span class="hs-identifier hs-var hs-var">loadPlugin'</span></a></span></span><span> </span><span id="local-6989586621681178693"><span class="annot"><span class="annottext">OccName
</span><a href="#local-6989586621681178693"><span class="hs-identifier hs-var">occ_name</span></a></span></span><span> </span><span id="local-6989586621681178692"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681178692"><span class="hs-identifier hs-var">plugin_name</span></a></span></span><span> </span><span id="local-6989586621681178691"><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681178691"><span class="hs-identifier hs-var">hsc_env</span></a></span></span><span> </span><span id="local-6989586621681178690"><span class="annot"><span class="annottext">ModuleName
</span><a href="#local-6989586621681178690"><span class="hs-identifier hs-var">mod_name</span></a></span></span><span>
</span><span id="line-115"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681178689"><span class="annot"><span class="annottext">plugin_rdr_name :: RdrName
</span><a href="#local-6989586621681178689"><span class="hs-identifier hs-var hs-var">plugin_rdr_name</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ModuleName -&gt; OccName -&gt; RdrName
</span><a href="GHC.Types.Name.Reader.html#mkRdrQual"><span class="hs-identifier hs-var">mkRdrQual</span></a></span><span> </span><span class="annot"><span class="annottext">ModuleName
</span><a href="#local-6989586621681178690"><span class="hs-identifier hs-var">mod_name</span></a></span><span> </span><span class="annot"><span class="annottext">OccName
</span><a href="#local-6989586621681178693"><span class="hs-identifier hs-var">occ_name</span></a></span><span>
</span><span id="line-116"></span><span>             </span><span id="local-6989586621681178688"><span class="annot"><span class="annottext">dflags :: DynFlags
</span><a href="#local-6989586621681178688"><span class="hs-identifier hs-var hs-var">dflags</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HscEnv -&gt; DynFlags
</span><a href="GHC.Driver.Types.html#hsc_dflags"><span class="hs-identifier hs-var hs-var">hsc_dflags</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681178691"><span class="hs-identifier hs-var">hsc_env</span></a></span><span>
</span><span id="line-117"></span><span>       </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681178687"><span class="annot"><span class="annottext">Maybe (Name, ModIface)
</span><a href="#local-6989586621681178687"><span class="hs-identifier hs-var">mb_name</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">HscEnv -&gt; ModuleName -&gt; RdrName -&gt; IO (Maybe (Name, ModIface))
</span><a href="GHC.Runtime.Loader.html#lookupRdrNameInModuleForPlugins"><span class="hs-identifier hs-var">lookupRdrNameInModuleForPlugins</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681178691"><span class="hs-identifier hs-var">hsc_env</span></a></span><span> </span><span class="annot"><span class="annottext">ModuleName
</span><a href="#local-6989586621681178690"><span class="hs-identifier hs-var">mod_name</span></a></span><span>
</span><span id="line-118"></span><span>                        </span><span class="annot"><span class="annottext">RdrName
</span><a href="#local-6989586621681178689"><span class="hs-identifier hs-var">plugin_rdr_name</span></a></span><span>
</span><span id="line-119"></span><span>       </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Maybe (Name, ModIface)
</span><a href="#local-6989586621681178687"><span class="hs-identifier hs-var">mb_name</span></a></span><span> </span><span class="hs-keyword">of</span><span> </span><span class="hs-special">{</span><span>
</span><span id="line-120"></span><span>            </span><span class="annot"><span class="annottext">Maybe (Name, ModIface)
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-121"></span><span>                </span><span class="annot"><span class="annottext">GhcException -&gt; IO (a, ModIface)
forall a. GhcException -&gt; IO a
</span><a href="GHC.Utils.Panic.html#throwGhcExceptionIO"><span class="hs-identifier hs-var">throwGhcExceptionIO</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CommandLineOption -&gt; GhcException
</span><a href="GHC.Utils.Panic.html#CmdLineError"><span class="hs-identifier hs-var">CmdLineError</span></a></span><span> </span><span class="annot"><span class="annottext">(CommandLineOption -&gt; GhcException)
-&gt; CommandLineOption -&gt; GhcException
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; SDoc -&gt; CommandLineOption
</span><a href="GHC.Utils.Outputable.html#showSDoc"><span class="hs-identifier hs-var">showSDoc</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681178688"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">(SDoc -&gt; CommandLineOption) -&gt; SDoc -&gt; CommandLineOption
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">[SDoc] -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#hsep"><span class="hs-identifier hs-var">hsep</span></a></span><span>
</span><span id="line-122"></span><span>                          </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">CommandLineOption -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">CommandLineOption
</span><span class="hs-string">&quot;The module&quot;</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ModuleName -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">ModuleName
</span><a href="#local-6989586621681178690"><span class="hs-identifier hs-var">mod_name</span></a></span><span>
</span><span id="line-123"></span><span>                          </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">CommandLineOption -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">CommandLineOption
</span><span class="hs-string">&quot;did not export the plugin name&quot;</span></span><span>
</span><span id="line-124"></span><span>                          </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">RdrName -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">RdrName
</span><a href="#local-6989586621681178689"><span class="hs-identifier hs-var">plugin_rdr_name</span></a></span><span> </span><span class="hs-special">]</span><span class="hs-special">)</span><span> </span><span class="hs-special">;</span><span>
</span><span id="line-125"></span><span>            </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621681178680"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681178680"><span class="hs-identifier hs-var">name</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681178679"><span class="annot"><span class="annottext">ModIface
</span><a href="#local-6989586621681178679"><span class="hs-identifier hs-var">mod_iface</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-126"></span><span>
</span><span id="line-127"></span><span>     </span><span class="hs-keyword">do</span><span> </span><span class="hs-special">{</span><span> </span><span id="local-6989586621681178678"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681178678"><span class="hs-identifier hs-var">plugin_tycon</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">HscEnv -&gt; Name -&gt; IO TyCon
</span><a href="GHC.Runtime.Loader.html#forceLoadTyCon"><span class="hs-identifier hs-var">forceLoadTyCon</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681178691"><span class="hs-identifier hs-var">hsc_env</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681178692"><span class="hs-identifier hs-var">plugin_name</span></a></span><span>
</span><span id="line-128"></span><span>        </span><span class="hs-special">;</span><span> </span><span id="local-6989586621681178677"><span class="annot"><span class="annottext">Maybe a
</span><a href="#local-6989586621681178677"><span class="hs-identifier hs-var">mb_plugin</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">HscEnv -&gt; Name -&gt; Type -&gt; IO (Maybe a)
forall a. HscEnv -&gt; Name -&gt; Type -&gt; IO (Maybe a)
</span><a href="GHC.Runtime.Loader.html#getValueSafely"><span class="hs-identifier hs-var">getValueSafely</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681178691"><span class="hs-identifier hs-var">hsc_env</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681178680"><span class="hs-identifier hs-var">name</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">TyCon -&gt; Type
</span><a href="GHC.Core.TyCo.Rep.html#mkTyConTy"><span class="hs-identifier hs-var">mkTyConTy</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681178678"><span class="hs-identifier hs-var">plugin_tycon</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-129"></span><span>        </span><span class="hs-special">;</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Maybe a
</span><a href="#local-6989586621681178677"><span class="hs-identifier hs-var">mb_plugin</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-130"></span><span>            </span><span class="annot"><span class="annottext">Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-131"></span><span>                </span><span class="annot"><span class="annottext">GhcException -&gt; IO (a, ModIface)
forall a. GhcException -&gt; IO a
</span><a href="GHC.Utils.Panic.html#throwGhcExceptionIO"><span class="hs-identifier hs-var">throwGhcExceptionIO</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CommandLineOption -&gt; GhcException
</span><a href="GHC.Utils.Panic.html#CmdLineError"><span class="hs-identifier hs-var">CmdLineError</span></a></span><span> </span><span class="annot"><span class="annottext">(CommandLineOption -&gt; GhcException)
-&gt; CommandLineOption -&gt; GhcException
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; SDoc -&gt; CommandLineOption
</span><a href="GHC.Utils.Outputable.html#showSDoc"><span class="hs-identifier hs-var">showSDoc</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681178688"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">(SDoc -&gt; CommandLineOption) -&gt; SDoc -&gt; CommandLineOption
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">[SDoc] -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#hsep"><span class="hs-identifier hs-var">hsep</span></a></span><span>
</span><span id="line-132"></span><span>                          </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">CommandLineOption -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">CommandLineOption
</span><span class="hs-string">&quot;The value&quot;</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Name -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681178680"><span class="hs-identifier hs-var">name</span></a></span><span>
</span><span id="line-133"></span><span>                          </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">CommandLineOption -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">CommandLineOption
</span><span class="hs-string">&quot;did not have the type&quot;</span></span><span>
</span><span id="line-134"></span><span>                          </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Name -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="GHC.Builtin.Names.html#pluginTyConName"><span class="hs-identifier hs-var">pluginTyConName</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">CommandLineOption -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">CommandLineOption
</span><span class="hs-string">&quot;as required&quot;</span></span><span class="hs-special">]</span><span class="hs-special">)</span><span>
</span><span id="line-135"></span><span>            </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621681178676"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621681178676"><span class="hs-identifier hs-var">plugin</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">(a, ModIface) -&gt; IO (a, ModIface)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621681178676"><span class="hs-identifier hs-var">plugin</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ModIface
</span><a href="#local-6989586621681178679"><span class="hs-identifier hs-var">mod_iface</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">}</span><span> </span><span class="hs-special">}</span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-136"></span><span>
</span><span id="line-137"></span><span>
</span><span id="line-138"></span><span class="hs-comment">-- | Force the interfaces for the given modules to be loaded. The 'SDoc' parameter is used</span><span>
</span><span id="line-139"></span><span class="hs-comment">-- for debugging (@-ddump-if-trace@) only: it is shown as the reason why the module is being loaded.</span><span>
</span><span id="line-140"></span><span class="annot"><a href="GHC.Runtime.Loader.html#forceLoadModuleInterfaces"><span class="hs-identifier hs-type">forceLoadModuleInterfaces</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Types.html#HscEnv"><span class="hs-identifier hs-type">HscEnv</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#SDoc"><span class="hs-identifier hs-type">SDoc</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Unit.Types.html#Module"><span class="hs-identifier hs-type">Module</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-141"></span><span id="forceLoadModuleInterfaces"><span class="annot"><span class="annottext">forceLoadModuleInterfaces :: HscEnv -&gt; SDoc -&gt; [Module] -&gt; IO ()
</span><a href="GHC.Runtime.Loader.html#forceLoadModuleInterfaces"><span class="hs-identifier hs-var hs-var">forceLoadModuleInterfaces</span></a></span></span><span> </span><span id="local-6989586621681178675"><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681178675"><span class="hs-identifier hs-var">hsc_env</span></a></span></span><span> </span><span id="local-6989586621681178674"><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621681178674"><span class="hs-identifier hs-var">doc</span></a></span></span><span> </span><span id="local-6989586621681178673"><span class="annot"><span class="annottext">[Module]
</span><a href="#local-6989586621681178673"><span class="hs-identifier hs-var">modules</span></a></span></span><span>
</span><span id="line-142"></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HscEnv -&gt; TcM () -&gt; IO (Messages, Maybe ())
forall a. HscEnv -&gt; TcM a -&gt; IO (Messages, Maybe a)
</span><a href="GHC.Tc.Utils.Monad.html#initTcInteractive"><span class="hs-identifier hs-var">initTcInteractive</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681178675"><span class="hs-identifier hs-var">hsc_env</span></a></span><span> </span><span class="annot"><span class="annottext">(TcM () -&gt; IO (Messages, Maybe ()))
-&gt; TcM () -&gt; IO (Messages, Maybe ())
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-143"></span><span>       </span><span class="annot"><span class="annottext">IfG () -&gt; TcM ()
forall a. IfG a -&gt; TcRn a
</span><a href="GHC.Tc.Utils.Monad.html#initIfaceTcRn"><span class="hs-identifier hs-var">initIfaceTcRn</span></a></span><span> </span><span class="annot"><span class="annottext">(IfG () -&gt; TcM ()) -&gt; IfG () -&gt; TcM ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-144"></span><span>       </span><span class="annot"><span class="annottext">(Module -&gt; IOEnv (Env IfGblEnv ()) ModIface) -&gt; [Module] -&gt; IfG ()
forall (t :: * -&gt; *) (m :: * -&gt; *) a b.
(Foldable t, Monad m) =&gt;
(a -&gt; m b) -&gt; t a -&gt; m ()
</span><a href="../../base/src/Data.Foldable.html#mapM_"><span class="hs-identifier hs-var">mapM_</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SDoc -&gt; Module -&gt; IOEnv (Env IfGblEnv ()) ModIface
forall lcl. SDoc -&gt; Module -&gt; IfM lcl ModIface
</span><a href="GHC.Iface.Load.html#loadPluginInterface"><span class="hs-identifier hs-var">loadPluginInterface</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621681178674"><span class="hs-identifier hs-var">doc</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[Module]
</span><a href="#local-6989586621681178673"><span class="hs-identifier hs-var">modules</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-145"></span><span>      </span><span class="annot"><span class="annottext">IO (Messages, Maybe ()) -&gt; IO () -&gt; IO ()
forall (m :: * -&gt; *) a b. Monad m =&gt; m a -&gt; m b -&gt; m b
</span><a href="../../base/src/GHC.Base.html#%3E%3E"><span class="hs-operator hs-var">&gt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">() -&gt; IO ()
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-146"></span><span>
</span><span id="line-147"></span><span class="hs-comment">-- | Force the interface for the module containing the name to be loaded. The 'SDoc' parameter is used</span><span>
</span><span id="line-148"></span><span class="hs-comment">-- for debugging (@-ddump-if-trace@) only: it is shown as the reason why the module is being loaded.</span><span>
</span><span id="line-149"></span><span class="annot"><a href="GHC.Runtime.Loader.html#forceLoadNameModuleInterface"><span class="hs-identifier hs-type">forceLoadNameModuleInterface</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Types.html#HscEnv"><span class="hs-identifier hs-type">HscEnv</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#SDoc"><span class="hs-identifier hs-type">SDoc</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Name.html#Name"><span class="hs-identifier hs-type">Name</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-150"></span><span id="forceLoadNameModuleInterface"><span class="annot"><span class="annottext">forceLoadNameModuleInterface :: HscEnv -&gt; SDoc -&gt; Name -&gt; IO ()
</span><a href="GHC.Runtime.Loader.html#forceLoadNameModuleInterface"><span class="hs-identifier hs-var hs-var">forceLoadNameModuleInterface</span></a></span></span><span> </span><span id="local-6989586621681178671"><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681178671"><span class="hs-identifier hs-var">hsc_env</span></a></span></span><span> </span><span id="local-6989586621681178670"><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621681178670"><span class="hs-identifier hs-var">reason</span></a></span></span><span> </span><span id="local-6989586621681178669"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681178669"><span class="hs-identifier hs-var">name</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-151"></span><span>    </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681178668"><span class="annot"><span class="annottext">name_modules :: [Module]
</span><a href="#local-6989586621681178668"><span class="hs-identifier hs-var hs-var">name_modules</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(Name -&gt; Maybe Module) -&gt; [Name] -&gt; [Module]
forall a b. (a -&gt; Maybe b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/Data.Maybe.html#mapMaybe"><span class="hs-identifier hs-var">mapMaybe</span></a></span><span> </span><span class="annot"><span class="annottext">Name -&gt; Maybe Module
</span><a href="GHC.Types.Name.html#nameModule_maybe"><span class="hs-identifier hs-var">nameModule_maybe</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681178669"><span class="hs-identifier hs-var">name</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-152"></span><span>    </span><span class="annot"><span class="annottext">HscEnv -&gt; SDoc -&gt; [Module] -&gt; IO ()
</span><a href="GHC.Runtime.Loader.html#forceLoadModuleInterfaces"><span class="hs-identifier hs-var">forceLoadModuleInterfaces</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681178671"><span class="hs-identifier hs-var">hsc_env</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621681178670"><span class="hs-identifier hs-var">reason</span></a></span><span> </span><span class="annot"><span class="annottext">[Module]
</span><a href="#local-6989586621681178668"><span class="hs-identifier hs-var">name_modules</span></a></span><span>
</span><span id="line-153"></span><span>
</span><span id="line-154"></span><span class="hs-comment">-- | Load the 'TyCon' associated with the given name, come hell or high water. Fails if:</span><span>
</span><span id="line-155"></span><span class="hs-comment">--</span><span>
</span><span id="line-156"></span><span class="hs-comment">-- * The interface could not be loaded</span><span>
</span><span id="line-157"></span><span class="hs-comment">-- * The name is not that of a 'TyCon'</span><span>
</span><span id="line-158"></span><span class="hs-comment">-- * The name did not exist in the loaded module</span><span>
</span><span id="line-159"></span><span class="annot"><a href="GHC.Runtime.Loader.html#forceLoadTyCon"><span class="hs-identifier hs-type">forceLoadTyCon</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Types.html#HscEnv"><span class="hs-identifier hs-type">HscEnv</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Name.html#Name"><span class="hs-identifier hs-type">Name</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="annot"><a href="GHC.Core.TyCon.html#TyCon"><span class="hs-identifier hs-type">TyCon</span></a></span><span>
</span><span id="line-160"></span><span id="forceLoadTyCon"><span class="annot"><span class="annottext">forceLoadTyCon :: HscEnv -&gt; Name -&gt; IO TyCon
</span><a href="GHC.Runtime.Loader.html#forceLoadTyCon"><span class="hs-identifier hs-var hs-var">forceLoadTyCon</span></a></span></span><span> </span><span id="local-6989586621681178667"><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681178667"><span class="hs-identifier hs-var">hsc_env</span></a></span></span><span> </span><span id="local-6989586621681178666"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681178666"><span class="hs-identifier hs-var">con_name</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-161"></span><span>    </span><span class="annot"><span class="annottext">HscEnv -&gt; SDoc -&gt; Name -&gt; IO ()
</span><a href="GHC.Runtime.Loader.html#forceLoadNameModuleInterface"><span class="hs-identifier hs-var">forceLoadNameModuleInterface</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681178667"><span class="hs-identifier hs-var">hsc_env</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CommandLineOption -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">CommandLineOption
</span><span class="hs-string">&quot;contains a name used in an invocation of loadTyConTy&quot;</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681178666"><span class="hs-identifier hs-var">con_name</span></a></span><span>
</span><span id="line-162"></span><span>
</span><span id="line-163"></span><span>    </span><span id="local-6989586621681178665"><span class="annot"><span class="annottext">Maybe TyThing
</span><a href="#local-6989586621681178665"><span class="hs-identifier hs-var">mb_con_thing</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">HscEnv -&gt; Name -&gt; IO (Maybe TyThing)
</span><a href="GHC.Driver.Types.html#lookupTypeHscEnv"><span class="hs-identifier hs-var">lookupTypeHscEnv</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681178667"><span class="hs-identifier hs-var">hsc_env</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681178666"><span class="hs-identifier hs-var">con_name</span></a></span><span>
</span><span id="line-164"></span><span>    </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Maybe TyThing
</span><a href="#local-6989586621681178665"><span class="hs-identifier hs-var">mb_con_thing</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-165"></span><span>        </span><span class="annot"><span class="annottext">Maybe TyThing
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; SDoc -&gt; IO TyCon
forall a. DynFlags -&gt; SDoc -&gt; IO a
</span><a href="GHC.Runtime.Loader.html#throwCmdLineErrorS"><span class="hs-identifier hs-var">throwCmdLineErrorS</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681178662"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">(SDoc -&gt; IO TyCon) -&gt; SDoc -&gt; IO TyCon
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Name -&gt; SDoc
</span><a href="GHC.Runtime.Loader.html#missingTyThingError"><span class="hs-identifier hs-var">missingTyThingError</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681178666"><span class="hs-identifier hs-var">con_name</span></a></span><span>
</span><span id="line-166"></span><span>        </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#ATyCon"><span class="hs-identifier hs-type">ATyCon</span></a></span><span> </span><span id="local-6989586621681178659"><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681178659"><span class="hs-identifier hs-var">tycon</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">TyCon -&gt; IO TyCon
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">TyCon
</span><a href="#local-6989586621681178659"><span class="hs-identifier hs-var">tycon</span></a></span><span>
</span><span id="line-167"></span><span>        </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621681178658"><span class="annot"><span class="annottext">TyThing
</span><a href="#local-6989586621681178658"><span class="hs-identifier hs-var">con_thing</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; SDoc -&gt; IO TyCon
forall a. DynFlags -&gt; SDoc -&gt; IO a
</span><a href="GHC.Runtime.Loader.html#throwCmdLineErrorS"><span class="hs-identifier hs-var">throwCmdLineErrorS</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681178662"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">(SDoc -&gt; IO TyCon) -&gt; SDoc -&gt; IO TyCon
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Name -&gt; TyThing -&gt; SDoc
</span><a href="GHC.Runtime.Loader.html#wrongTyThingError"><span class="hs-identifier hs-var">wrongTyThingError</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681178666"><span class="hs-identifier hs-var">con_name</span></a></span><span> </span><span class="annot"><span class="annottext">TyThing
</span><a href="#local-6989586621681178658"><span class="hs-identifier hs-var">con_thing</span></a></span><span>
</span><span id="line-168"></span><span>  </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621681178662"><span class="annot"><span class="annottext">dflags :: DynFlags
</span><a href="#local-6989586621681178662"><span class="hs-identifier hs-var hs-var">dflags</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HscEnv -&gt; DynFlags
</span><a href="GHC.Driver.Types.html#hsc_dflags"><span class="hs-identifier hs-var hs-var">hsc_dflags</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681178667"><span class="hs-identifier hs-var">hsc_env</span></a></span><span>
</span><span id="line-169"></span><span>
</span><span id="line-170"></span><span class="hs-comment">-- | Loads the value corresponding to a 'Name' if that value has the given 'Type'. This only provides limited safety</span><span>
</span><span id="line-171"></span><span class="hs-comment">-- in that it is up to the user to ensure that that type corresponds to the type you try to use the return value at!</span><span>
</span><span id="line-172"></span><span class="hs-comment">--</span><span>
</span><span id="line-173"></span><span class="hs-comment">-- If the value found was not of the correct type, returns @Nothing@. Any other condition results in an exception:</span><span>
</span><span id="line-174"></span><span class="hs-comment">--</span><span>
</span><span id="line-175"></span><span class="hs-comment">-- * If we could not load the names module</span><span>
</span><span id="line-176"></span><span class="hs-comment">-- * If the thing being loaded is not a value</span><span>
</span><span id="line-177"></span><span class="hs-comment">-- * If the Name does not exist in the module</span><span>
</span><span id="line-178"></span><span class="hs-comment">-- * If the link failed</span><span>
</span><span id="line-179"></span><span>
</span><span id="line-180"></span><span id="local-6989586621681178906"><span class="annot"><a href="GHC.Runtime.Loader.html#getValueSafely"><span class="hs-identifier hs-type">getValueSafely</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Types.html#HscEnv"><span class="hs-identifier hs-type">HscEnv</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Name.html#Name"><span class="hs-identifier hs-type">Name</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="#local-6989586621681178906"><span class="hs-identifier hs-type">a</span></a></span><span class="hs-special">)</span></span><span>
</span><span id="line-181"></span><span id="getValueSafely"><span class="annot"><span class="annottext">getValueSafely :: forall a. HscEnv -&gt; Name -&gt; Type -&gt; IO (Maybe a)
</span><a href="GHC.Runtime.Loader.html#getValueSafely"><span class="hs-identifier hs-var hs-var">getValueSafely</span></a></span></span><span> </span><span id="local-6989586621681178652"><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681178652"><span class="hs-identifier hs-var">hsc_env</span></a></span></span><span> </span><span id="local-6989586621681178651"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681178651"><span class="hs-identifier hs-var">val_name</span></a></span></span><span> </span><span id="local-6989586621681178650"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681178650"><span class="hs-identifier hs-var">expected_type</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-182"></span><span>  </span><span id="local-6989586621681178649"><span class="annot"><span class="annottext">Maybe HValue
</span><a href="#local-6989586621681178649"><span class="hs-identifier hs-var">mb_hval</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">(Hooks -&gt; Maybe (HscEnv -&gt; Name -&gt; Type -&gt; IO (Maybe HValue)))
-&gt; (HscEnv -&gt; Name -&gt; Type -&gt; IO (Maybe HValue))
-&gt; DynFlags
-&gt; HscEnv
-&gt; Name
-&gt; Type
-&gt; IO (Maybe HValue)
forall a. (Hooks -&gt; Maybe a) -&gt; a -&gt; DynFlags -&gt; a
</span><a href="GHC.Driver.Hooks.html#lookupHook"><span class="hs-identifier hs-var">lookupHook</span></a></span><span> </span><span class="annot"><span class="annottext">Hooks -&gt; Maybe (HscEnv -&gt; Name -&gt; Type -&gt; IO (Maybe HValue))
</span><a href="GHC.Driver.Hooks.html#getValueSafelyHook"><span class="hs-identifier hs-var hs-var">getValueSafelyHook</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv -&gt; Name -&gt; Type -&gt; IO (Maybe HValue)
</span><a href="GHC.Runtime.Loader.html#getHValueSafely"><span class="hs-identifier hs-var">getHValueSafely</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681178646"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681178652"><span class="hs-identifier hs-var">hsc_env</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681178651"><span class="hs-identifier hs-var">val_name</span></a></span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681178650"><span class="hs-identifier hs-var">expected_type</span></a></span><span>
</span><span id="line-183"></span><span>  </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Maybe HValue
</span><a href="#local-6989586621681178649"><span class="hs-identifier hs-var">mb_hval</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-184"></span><span>    </span><span class="annot"><span class="annottext">Maybe HValue
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>   </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Maybe a -&gt; IO (Maybe a)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe a
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-185"></span><span>    </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621681178645"><span class="annot"><span class="annottext">HValue
</span><a href="#local-6989586621681178645"><span class="hs-identifier hs-var">hval</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-186"></span><span>      </span><span id="local-6989586621681178644"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621681178644"><span class="hs-identifier hs-var">value</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; CommandLineOption -&gt; HValue -&gt; IO a
forall a b. DynFlags -&gt; CommandLineOption -&gt; a -&gt; IO b
</span><a href="GHC.Runtime.Loader.html#lessUnsafeCoerce"><span class="hs-identifier hs-var">lessUnsafeCoerce</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681178646"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">CommandLineOption
</span><span class="hs-string">&quot;getValueSafely&quot;</span></span><span> </span><span class="annot"><span class="annottext">HValue
</span><a href="#local-6989586621681178645"><span class="hs-identifier hs-var">hval</span></a></span><span>
</span><span id="line-187"></span><span>      </span><span class="annot"><span class="annottext">Maybe a -&gt; IO (Maybe a)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; Maybe a
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621681178644"><span class="hs-identifier hs-var">value</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-188"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-189"></span><span>    </span><span id="local-6989586621681178646"><span class="annot"><span class="annottext">dflags :: DynFlags
</span><a href="#local-6989586621681178646"><span class="hs-identifier hs-var hs-var">dflags</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HscEnv -&gt; DynFlags
</span><a href="GHC.Driver.Types.html#hsc_dflags"><span class="hs-identifier hs-var hs-var">hsc_dflags</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681178652"><span class="hs-identifier hs-var">hsc_env</span></a></span><span>
</span><span id="line-190"></span><span>
</span><span id="line-191"></span><span class="annot"><a href="GHC.Runtime.Loader.html#getHValueSafely"><span class="hs-identifier hs-type">getHValueSafely</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Types.html#HscEnv"><span class="hs-identifier hs-type">HscEnv</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Name.html#Name"><span class="hs-identifier hs-type">Name</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#Type"><span class="hs-identifier hs-type">Type</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="../../ghci/src/GHCi.RemoteTypes.html#HValue"><span class="hs-identifier hs-type">HValue</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-192"></span><span id="getHValueSafely"><span class="annot"><span class="annottext">getHValueSafely :: HscEnv -&gt; Name -&gt; Type -&gt; IO (Maybe HValue)
</span><a href="GHC.Runtime.Loader.html#getHValueSafely"><span class="hs-identifier hs-var hs-var">getHValueSafely</span></a></span></span><span> </span><span id="local-6989586621681178643"><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681178643"><span class="hs-identifier hs-var">hsc_env</span></a></span></span><span> </span><span id="local-6989586621681178642"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681178642"><span class="hs-identifier hs-var">val_name</span></a></span></span><span> </span><span id="local-6989586621681178641"><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681178641"><span class="hs-identifier hs-var">expected_type</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-193"></span><span>    </span><span class="annot"><span class="annottext">HscEnv -&gt; SDoc -&gt; Name -&gt; IO ()
</span><a href="GHC.Runtime.Loader.html#forceLoadNameModuleInterface"><span class="hs-identifier hs-var">forceLoadNameModuleInterface</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681178643"><span class="hs-identifier hs-var">hsc_env</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CommandLineOption -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">CommandLineOption
</span><span class="hs-string">&quot;contains a name used in an invocation of getHValueSafely&quot;</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681178642"><span class="hs-identifier hs-var">val_name</span></a></span><span>
</span><span id="line-194"></span><span>    </span><span class="hs-comment">-- Now look up the names for the value and type constructor in the type environment</span><span>
</span><span id="line-195"></span><span>    </span><span id="local-6989586621681178640"><span class="annot"><span class="annottext">Maybe TyThing
</span><a href="#local-6989586621681178640"><span class="hs-identifier hs-var">mb_val_thing</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">HscEnv -&gt; Name -&gt; IO (Maybe TyThing)
</span><a href="GHC.Driver.Types.html#lookupTypeHscEnv"><span class="hs-identifier hs-var">lookupTypeHscEnv</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681178643"><span class="hs-identifier hs-var">hsc_env</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681178642"><span class="hs-identifier hs-var">val_name</span></a></span><span>
</span><span id="line-196"></span><span>    </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Maybe TyThing
</span><a href="#local-6989586621681178640"><span class="hs-identifier hs-var">mb_val_thing</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-197"></span><span>        </span><span class="annot"><span class="annottext">Maybe TyThing
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; SDoc -&gt; IO (Maybe HValue)
forall a. DynFlags -&gt; SDoc -&gt; IO a
</span><a href="GHC.Runtime.Loader.html#throwCmdLineErrorS"><span class="hs-identifier hs-var">throwCmdLineErrorS</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681178639"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">(SDoc -&gt; IO (Maybe HValue)) -&gt; SDoc -&gt; IO (Maybe HValue)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Name -&gt; SDoc
</span><a href="GHC.Runtime.Loader.html#missingTyThingError"><span class="hs-identifier hs-var">missingTyThingError</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681178642"><span class="hs-identifier hs-var">val_name</span></a></span><span>
</span><span id="line-198"></span><span>        </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#AnId"><span class="hs-identifier hs-type">AnId</span></a></span><span> </span><span id="local-6989586621681178637"><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681178637"><span class="hs-identifier hs-var">id</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-199"></span><span>            </span><span class="hs-comment">-- Check the value type in the interface against the type recovered from the type constructor</span><span>
</span><span id="line-200"></span><span>            </span><span class="hs-comment">-- before finally casting the value to the type we assume corresponds to that constructor</span><span>
</span><span id="line-201"></span><span>            </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">Type
</span><a href="#local-6989586621681178641"><span class="hs-identifier hs-var">expected_type</span></a></span><span> </span><span class="annot"><span class="annottext">Type -&gt; Type -&gt; Bool
</span><a href="GHC.Core.Type.html#eqType"><span class="hs-operator hs-var">`eqType`</span></a></span><span> </span><span class="annot"><span class="annottext">Id -&gt; Type
</span><a href="GHC.Types.Id.html#idType"><span class="hs-identifier hs-var">idType</span></a></span><span> </span><span class="annot"><span class="annottext">Id
</span><a href="#local-6989586621681178637"><span class="hs-identifier hs-var">id</span></a></span><span>
</span><span id="line-202"></span><span>             </span><span class="hs-keyword">then</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-203"></span><span>                </span><span class="hs-comment">-- Link in the module that contains the value, if it has such a module</span><span>
</span><span id="line-204"></span><span>                </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Name -&gt; Maybe Module
</span><a href="GHC.Types.Name.html#nameModule_maybe"><span class="hs-identifier hs-var">nameModule_maybe</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681178642"><span class="hs-identifier hs-var">val_name</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-205"></span><span>                    </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621681178636"><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681178636"><span class="hs-identifier hs-var">mod</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span> </span><span class="annot"><span class="annottext">HscEnv -&gt; Module -&gt; IO ()
</span><a href="GHC.Runtime.Linker.html#linkModule"><span class="hs-identifier hs-var">linkModule</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681178643"><span class="hs-identifier hs-var">hsc_env</span></a></span><span> </span><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681178636"><span class="hs-identifier hs-var">mod</span></a></span><span>
</span><span id="line-206"></span><span>                                   </span><span class="annot"><span class="annottext">() -&gt; IO ()
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-207"></span><span>                    </span><span class="annot"><span class="annottext">Maybe Module
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span>  </span><span class="annot"><span class="annottext">() -&gt; IO ()
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span>
</span><span id="line-208"></span><span>                </span><span class="hs-comment">-- Find the value that we just linked in and cast it given that we have proved it's type</span><span>
</span><span id="line-209"></span><span>                </span><span id="local-6989586621681178635"><span class="annot"><span class="annottext">HValue
</span><a href="#local-6989586621681178635"><span class="hs-identifier hs-var">hval</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">HscEnv -&gt; (Interp -&gt; IO HValue) -&gt; IO HValue
forall a. HscEnv -&gt; (Interp -&gt; IO a) -&gt; IO a
</span><a href="GHC.Runtime.Interpreter.html#withInterp"><span class="hs-identifier hs-var">withInterp</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681178643"><span class="hs-identifier hs-var">hsc_env</span></a></span><span> </span><span class="annot"><span class="annottext">((Interp -&gt; IO HValue) -&gt; IO HValue)
-&gt; (Interp -&gt; IO HValue) -&gt; IO HValue
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-glyph">\</span><span id="local-6989586621681178634"><span class="annot"><span class="annottext">Interp
</span><a href="#local-6989586621681178634"><span class="hs-identifier hs-var">interp</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">HscEnv -&gt; Name -&gt; IO ForeignHValue
</span><a href="GHC.Runtime.Linker.html#getHValue"><span class="hs-identifier hs-var">getHValue</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681178643"><span class="hs-identifier hs-var">hsc_env</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681178642"><span class="hs-identifier hs-var">val_name</span></a></span><span> </span><span class="annot"><span class="annottext">IO ForeignHValue -&gt; (ForeignHValue -&gt; IO HValue) -&gt; IO HValue
forall (m :: * -&gt; *) a b. Monad m =&gt; m a -&gt; (a -&gt; m b) -&gt; m b
</span><a href="../../base/src/GHC.Base.html#%3E%3E%3D"><span class="hs-operator hs-var">&gt;&gt;=</span></a></span><span> </span><span class="annot"><span class="annottext">Interp -&gt; ForeignHValue -&gt; IO HValue
forall a. Interp -&gt; ForeignRef a -&gt; IO a
</span><a href="GHC.Runtime.Interpreter.html#wormhole"><span class="hs-identifier hs-var">wormhole</span></a></span><span> </span><span class="annot"><span class="annottext">Interp
</span><a href="#local-6989586621681178634"><span class="hs-identifier hs-var">interp</span></a></span><span>
</span><span id="line-210"></span><span>                </span><span class="annot"><span class="annottext">Maybe HValue -&gt; IO (Maybe HValue)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">HValue -&gt; Maybe HValue
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">HValue
</span><a href="#local-6989586621681178635"><span class="hs-identifier hs-var">hval</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-211"></span><span>             </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">Maybe HValue -&gt; IO (Maybe HValue)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe HValue
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-212"></span><span>        </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621681178633"><span class="annot"><span class="annottext">TyThing
</span><a href="#local-6989586621681178633"><span class="hs-identifier hs-var">val_thing</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; SDoc -&gt; IO (Maybe HValue)
forall a. DynFlags -&gt; SDoc -&gt; IO a
</span><a href="GHC.Runtime.Loader.html#throwCmdLineErrorS"><span class="hs-identifier hs-var">throwCmdLineErrorS</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681178639"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">(SDoc -&gt; IO (Maybe HValue)) -&gt; SDoc -&gt; IO (Maybe HValue)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Name -&gt; TyThing -&gt; SDoc
</span><a href="GHC.Runtime.Loader.html#wrongTyThingError"><span class="hs-identifier hs-var">wrongTyThingError</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681178642"><span class="hs-identifier hs-var">val_name</span></a></span><span> </span><span class="annot"><span class="annottext">TyThing
</span><a href="#local-6989586621681178633"><span class="hs-identifier hs-var">val_thing</span></a></span><span>
</span><span id="line-213"></span><span>   </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621681178639"><span class="annot"><span class="annottext">dflags :: DynFlags
</span><a href="#local-6989586621681178639"><span class="hs-identifier hs-var hs-var">dflags</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HscEnv -&gt; DynFlags
</span><a href="GHC.Driver.Types.html#hsc_dflags"><span class="hs-identifier hs-var hs-var">hsc_dflags</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681178643"><span class="hs-identifier hs-var">hsc_env</span></a></span><span>
</span><span id="line-214"></span><span>
</span><span id="line-215"></span><span class="hs-comment">-- | Coerce a value as usual, but:</span><span>
</span><span id="line-216"></span><span class="hs-comment">--</span><span>
</span><span id="line-217"></span><span class="hs-comment">-- 1) Evaluate it immediately to get a segfault early if the coercion was wrong</span><span>
</span><span id="line-218"></span><span class="hs-comment">--</span><span>
</span><span id="line-219"></span><span class="hs-comment">-- 2) Wrap it in some debug messages at verbosity 3 or higher so we can see what happened</span><span>
</span><span id="line-220"></span><span class="hs-comment">--    if it /does/ segfault</span><span>
</span><span id="line-221"></span><span id="local-6989586621681178880"><span id="local-6989586621681178881"><span class="annot"><a href="GHC.Runtime.Loader.html#lessUnsafeCoerce"><span class="hs-identifier hs-type">lessUnsafeCoerce</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html#DynFlags"><span class="hs-identifier hs-type">DynFlags</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621681178881"><span class="hs-identifier hs-type">a</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="annot"><a href="#local-6989586621681178880"><span class="hs-identifier hs-type">b</span></a></span></span></span><span>
</span><span id="line-222"></span><span id="lessUnsafeCoerce"><span class="annot"><span class="annottext">lessUnsafeCoerce :: forall a b. DynFlags -&gt; CommandLineOption -&gt; a -&gt; IO b
</span><a href="GHC.Runtime.Loader.html#lessUnsafeCoerce"><span class="hs-identifier hs-var hs-var">lessUnsafeCoerce</span></a></span></span><span> </span><span id="local-6989586621681178628"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681178628"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span id="local-6989586621681178627"><span class="annot"><span class="annottext">CommandLineOption
</span><a href="#local-6989586621681178627"><span class="hs-identifier hs-var">context</span></a></span></span><span> </span><span id="local-6989586621681178626"><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621681178626"><span class="hs-identifier hs-var">what</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-223"></span><span>    </span><span class="annot"><span class="annottext">DynFlags -&gt; Int -&gt; SDoc -&gt; IO ()
</span><a href="GHC.Utils.Error.html#debugTraceMsg"><span class="hs-identifier hs-var">debugTraceMsg</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681178628"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">3</span></span><span> </span><span class="annot"><span class="annottext">(SDoc -&gt; IO ()) -&gt; SDoc -&gt; IO ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CommandLineOption -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">CommandLineOption
</span><span class="hs-string">&quot;Coercing a value in&quot;</span></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CommandLineOption -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">CommandLineOption
</span><a href="#local-6989586621681178627"><span class="hs-identifier hs-var">context</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">SDoc -&gt; SDoc -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#%3C%3E"><span class="hs-operator hs-var">&lt;&gt;</span></a></span><span>
</span><span id="line-224"></span><span>                             </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CommandLineOption -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">CommandLineOption
</span><span class="hs-string">&quot;...&quot;</span></span><span class="hs-special">)</span><span>
</span><span id="line-225"></span><span>    </span><span id="local-6989586621681178622"><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621681178622"><span class="hs-identifier hs-var">output</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">b -&gt; IO b
forall a. a -&gt; IO a
</span><a href="../../base/src/GHC.IO.html#evaluate"><span class="hs-identifier hs-var">evaluate</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">a -&gt; b
forall a b. a -&gt; b
</span><a href="../../base/src/Unsafe.Coerce.html#unsafeCoerce"><span class="hs-identifier hs-var">unsafeCoerce</span></a></span><span> </span><span class="annot"><span class="annottext">a
</span><a href="#local-6989586621681178626"><span class="hs-identifier hs-var">what</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-226"></span><span>    </span><span class="annot"><span class="annottext">DynFlags -&gt; Int -&gt; SDoc -&gt; IO ()
</span><a href="GHC.Utils.Error.html#debugTraceMsg"><span class="hs-identifier hs-var">debugTraceMsg</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681178628"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">3</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CommandLineOption -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">CommandLineOption
</span><span class="hs-string">&quot;Successfully evaluated coercion&quot;</span></span><span class="hs-special">)</span><span>
</span><span id="line-227"></span><span>    </span><span class="annot"><span class="annottext">b -&gt; IO b
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">b
</span><a href="#local-6989586621681178622"><span class="hs-identifier hs-var">output</span></a></span><span>
</span><span id="line-228"></span><span>
</span><span id="line-229"></span><span>
</span><span id="line-230"></span><span class="hs-comment">-- | Finds the 'Name' corresponding to the given 'RdrName' in the</span><span>
</span><span id="line-231"></span><span class="hs-comment">-- context of the 'ModuleName'. Returns @Nothing@ if no such 'Name'</span><span>
</span><span id="line-232"></span><span class="hs-comment">-- could be found. Any other condition results in an exception:</span><span>
</span><span id="line-233"></span><span class="hs-comment">--</span><span>
</span><span id="line-234"></span><span class="hs-comment">-- * If the module could not be found</span><span>
</span><span id="line-235"></span><span class="hs-comment">-- * If we could not determine the imports of the module</span><span>
</span><span id="line-236"></span><span class="hs-comment">--</span><span>
</span><span id="line-237"></span><span class="hs-comment">-- Can only be used for looking up names while loading plugins (and is</span><span>
</span><span id="line-238"></span><span class="hs-comment">-- *not* suitable for use within plugins).  The interface file is</span><span>
</span><span id="line-239"></span><span class="hs-comment">-- loaded very partially: just enough that it can be used, without its</span><span>
</span><span id="line-240"></span><span class="hs-comment">-- rules and instances affecting (and being linked from!) the module</span><span>
</span><span id="line-241"></span><span class="hs-comment">-- being compiled.  This was introduced by 57d6798.</span><span>
</span><span id="line-242"></span><span class="hs-comment">--</span><span>
</span><span id="line-243"></span><span class="hs-comment">-- Need the module as well to record information in the interface file</span><span>
</span><span id="line-244"></span><span class="annot"><a href="GHC.Runtime.Loader.html#lookupRdrNameInModuleForPlugins"><span class="hs-identifier hs-type">lookupRdrNameInModuleForPlugins</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Types.html#HscEnv"><span class="hs-identifier hs-type">HscEnv</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Unit.Module.Name.html#ModuleName"><span class="hs-identifier hs-type">ModuleName</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.Name.Reader.html#RdrName"><span class="hs-identifier hs-type">RdrName</span></a></span><span>
</span><span id="line-245"></span><span>                                </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.Name.html#Name"><span class="hs-identifier hs-type">Name</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Driver.Types.html#ModIface"><span class="hs-identifier hs-type">ModIface</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-246"></span><span id="lookupRdrNameInModuleForPlugins"><span class="annot"><span class="annottext">lookupRdrNameInModuleForPlugins :: HscEnv -&gt; ModuleName -&gt; RdrName -&gt; IO (Maybe (Name, ModIface))
</span><a href="GHC.Runtime.Loader.html#lookupRdrNameInModuleForPlugins"><span class="hs-identifier hs-var hs-var">lookupRdrNameInModuleForPlugins</span></a></span></span><span> </span><span id="local-6989586621681178620"><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681178620"><span class="hs-identifier hs-var">hsc_env</span></a></span></span><span> </span><span id="local-6989586621681178619"><span class="annot"><span class="annottext">ModuleName
</span><a href="#local-6989586621681178619"><span class="hs-identifier hs-var">mod_name</span></a></span></span><span> </span><span id="local-6989586621681178618"><span class="annot"><span class="annottext">RdrName
</span><a href="#local-6989586621681178618"><span class="hs-identifier hs-var">rdr_name</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-247"></span><span>    </span><span class="hs-comment">-- First find the unit the module resides in by searching exposed units and home modules</span><span>
</span><span id="line-248"></span><span>    </span><span id="local-6989586621681178617"><span class="annot"><span class="annottext">FindResult
</span><a href="#local-6989586621681178617"><span class="hs-identifier hs-var">found_module</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">HscEnv -&gt; ModuleName -&gt; IO FindResult
</span><a href="GHC.Driver.Finder.html#findPluginModule"><span class="hs-identifier hs-var">findPluginModule</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681178620"><span class="hs-identifier hs-var">hsc_env</span></a></span><span> </span><span class="annot"><span class="annottext">ModuleName
</span><a href="#local-6989586621681178619"><span class="hs-identifier hs-var">mod_name</span></a></span><span>
</span><span id="line-249"></span><span>    </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">FindResult
</span><a href="#local-6989586621681178617"><span class="hs-identifier hs-var">found_module</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-250"></span><span>        </span><span class="annot"><a href="GHC.Driver.Types.html#Found"><span class="hs-identifier hs-type">Found</span></a></span><span> </span><span class="annot"><span class="annottext">ModLocation
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621681178615"><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681178615"><span class="hs-identifier hs-var">mod</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-251"></span><span>            </span><span class="hs-comment">-- Find the exports of the module</span><span>
</span><span id="line-252"></span><span>            </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Messages
</span><span class="hs-identifier">_</span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621681178614"><span class="annot"><span class="annottext">Maybe ModIface
</span><a href="#local-6989586621681178614"><span class="hs-identifier hs-var">mb_iface</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">HscEnv -&gt; TcM ModIface -&gt; IO (Messages, Maybe ModIface)
forall a. HscEnv -&gt; TcM a -&gt; IO (Messages, Maybe a)
</span><a href="GHC.Tc.Utils.Monad.html#initTcInteractive"><span class="hs-identifier hs-var">initTcInteractive</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681178620"><span class="hs-identifier hs-var">hsc_env</span></a></span><span> </span><span class="annot"><span class="annottext">(TcM ModIface -&gt; IO (Messages, Maybe ModIface))
-&gt; TcM ModIface -&gt; IO (Messages, Maybe ModIface)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-253"></span><span>                             </span><span class="annot"><span class="annottext">IOEnv (Env IfGblEnv ()) ModIface -&gt; TcM ModIface
forall a. IfG a -&gt; TcRn a
</span><a href="GHC.Tc.Utils.Monad.html#initIfaceTcRn"><span class="hs-identifier hs-var">initIfaceTcRn</span></a></span><span> </span><span class="annot"><span class="annottext">(IOEnv (Env IfGblEnv ()) ModIface -&gt; TcM ModIface)
-&gt; IOEnv (Env IfGblEnv ()) ModIface -&gt; TcM ModIface
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-254"></span><span>                             </span><span class="annot"><span class="annottext">SDoc -&gt; Module -&gt; IOEnv (Env IfGblEnv ()) ModIface
forall lcl. SDoc -&gt; Module -&gt; IfM lcl ModIface
</span><a href="GHC.Iface.Load.html#loadPluginInterface"><span class="hs-identifier hs-var">loadPluginInterface</span></a></span><span> </span><span class="annot"><span class="annottext">SDoc
</span><a href="#local-6989586621681178613"><span class="hs-identifier hs-var">doc</span></a></span><span> </span><span class="annot"><span class="annottext">Module
</span><a href="#local-6989586621681178615"><span class="hs-identifier hs-var">mod</span></a></span><span>
</span><span id="line-255"></span><span>            </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Maybe ModIface
</span><a href="#local-6989586621681178614"><span class="hs-identifier hs-var">mb_iface</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-256"></span><span>                </span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-type">Just</span></a></span><span> </span><span id="local-6989586621681178612"><span class="annot"><span class="annottext">ModIface
</span><a href="#local-6989586621681178612"><span class="hs-identifier hs-var">iface</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-257"></span><span>                    </span><span class="hs-comment">-- Try and find the required name in the exports</span><span>
</span><span id="line-258"></span><span>                    </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621681178611"><span class="annot"><span class="annottext">decl_spec :: ImpDeclSpec
</span><a href="#local-6989586621681178611"><span class="hs-identifier hs-var hs-var">decl_spec</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ImpDeclSpec :: ModuleName -&gt; ModuleName -&gt; Bool -&gt; SrcSpan -&gt; ImpDeclSpec
</span><a href="GHC.Types.Name.Reader.html#ImpDeclSpec"><span class="hs-identifier hs-type">ImpDeclSpec</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">is_mod :: ModuleName
</span><a href="GHC.Types.Name.Reader.html#is_mod"><span class="hs-identifier hs-var">is_mod</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ModuleName
</span><a href="#local-6989586621681178619"><span class="hs-identifier hs-var">mod_name</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">is_as :: ModuleName
</span><a href="GHC.Types.Name.Reader.html#is_as"><span class="hs-identifier hs-var">is_as</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ModuleName
</span><a href="#local-6989586621681178619"><span class="hs-identifier hs-var">mod_name</span></a></span><span>
</span><span id="line-259"></span><span>                                                </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">is_qual :: Bool
</span><a href="GHC.Types.Name.Reader.html#is_qual"><span class="hs-identifier hs-var">is_qual</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">is_dloc :: SrcSpan
</span><a href="GHC.Types.Name.Reader.html#is_dloc"><span class="hs-identifier hs-var">is_dloc</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="GHC.Types.SrcLoc.html#noSrcSpan"><span class="hs-identifier hs-var">noSrcSpan</span></a></span><span> </span><span class="hs-special">}</span><span>
</span><span id="line-260"></span><span>                        </span><span id="local-6989586621681178605"><span class="annot"><span class="annottext">imp_spec :: ImportSpec
</span><a href="#local-6989586621681178605"><span class="hs-identifier hs-var hs-var">imp_spec</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ImpDeclSpec -&gt; ImpItemSpec -&gt; ImportSpec
</span><a href="GHC.Types.Name.Reader.html#ImpSpec"><span class="hs-identifier hs-var">ImpSpec</span></a></span><span> </span><span class="annot"><span class="annottext">ImpDeclSpec
</span><a href="#local-6989586621681178611"><span class="hs-identifier hs-var">decl_spec</span></a></span><span> </span><span class="annot"><span class="annottext">ImpItemSpec
</span><a href="GHC.Types.Name.Reader.html#ImpAll"><span class="hs-identifier hs-var">ImpAll</span></a></span><span>
</span><span id="line-261"></span><span>                        </span><span id="local-6989586621681178602"><span class="annot"><span class="annottext">env :: GlobalRdrEnv
</span><a href="#local-6989586621681178602"><span class="hs-identifier hs-var hs-var">env</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[GlobalRdrElt] -&gt; GlobalRdrEnv
</span><a href="GHC.Types.Name.Reader.html#mkGlobalRdrEnv"><span class="hs-identifier hs-var">mkGlobalRdrEnv</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Maybe ImportSpec -&gt; [AvailInfo] -&gt; [GlobalRdrElt]
</span><a href="GHC.Types.Name.Reader.html#gresFromAvails"><span class="hs-identifier hs-var">gresFromAvails</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ImportSpec -&gt; Maybe ImportSpec
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="annot"><span class="annottext">ImportSpec
</span><a href="#local-6989586621681178605"><span class="hs-identifier hs-var">imp_spec</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ModIface -&gt; [AvailInfo]
forall (phase :: ModIfacePhase). ModIface_ phase -&gt; [AvailInfo]
</span><a href="GHC.Driver.Types.html#mi_exports"><span class="hs-identifier hs-var hs-var">mi_exports</span></a></span><span> </span><span class="annot"><span class="annottext">ModIface
</span><a href="#local-6989586621681178612"><span class="hs-identifier hs-var">iface</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-262"></span><span>                    </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">RdrName -&gt; GlobalRdrEnv -&gt; [GlobalRdrElt]
</span><a href="GHC.Types.Name.Reader.html#lookupGRE_RdrName"><span class="hs-identifier hs-var">lookupGRE_RdrName</span></a></span><span> </span><span class="annot"><span class="annottext">RdrName
</span><a href="#local-6989586621681178618"><span class="hs-identifier hs-var">rdr_name</span></a></span><span> </span><span class="annot"><span class="annottext">GlobalRdrEnv
</span><a href="#local-6989586621681178602"><span class="hs-identifier hs-var">env</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-263"></span><span>                        </span><span class="hs-special">[</span><span id="local-6989586621681178600"><span class="annot"><span class="annottext">GlobalRdrElt
</span><a href="#local-6989586621681178600"><span class="hs-identifier hs-var">gre</span></a></span></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Maybe (Name, ModIface) -&gt; IO (Maybe (Name, ModIface))
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Name, ModIface) -&gt; Maybe (Name, ModIface)
forall a. a -&gt; Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Just"><span class="hs-identifier hs-var">Just</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">GlobalRdrElt -&gt; Name
</span><a href="GHC.Types.Name.Reader.html#gre_name"><span class="hs-identifier hs-var hs-var">gre_name</span></a></span><span> </span><span class="annot"><span class="annottext">GlobalRdrElt
</span><a href="#local-6989586621681178600"><span class="hs-identifier hs-var">gre</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ModIface
</span><a href="#local-6989586621681178612"><span class="hs-identifier hs-var">iface</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-264"></span><span>                        </span><span class="hs-special">[</span><span class="hs-special">]</span><span>    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Maybe (Name, ModIface) -&gt; IO (Maybe (Name, ModIface))
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe (Name, ModIface)
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>
</span><span id="line-265"></span><span>                        </span><span class="annot"><span class="annottext">[GlobalRdrElt]
</span><span class="hs-identifier">_</span></span><span>     </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">CommandLineOption -&gt; IO (Maybe (Name, ModIface))
forall a. CommandLineOption -&gt; a
</span><a href="GHC.Utils.Panic.Plain.html#panic"><span class="hs-identifier hs-var">panic</span></a></span><span> </span><span class="annot"><span class="annottext">CommandLineOption
</span><span class="hs-string">&quot;lookupRdrNameInModule&quot;</span></span><span>
</span><span id="line-266"></span><span>
</span><span id="line-267"></span><span>                </span><span class="annot"><span class="annottext">Maybe ModIface
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; SDoc -&gt; IO (Maybe (Name, ModIface))
forall a. DynFlags -&gt; SDoc -&gt; IO a
</span><a href="GHC.Runtime.Loader.html#throwCmdLineErrorS"><span class="hs-identifier hs-var">throwCmdLineErrorS</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681178598"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">(SDoc -&gt; IO (Maybe (Name, ModIface)))
-&gt; SDoc -&gt; IO (Maybe (Name, ModIface))
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">[SDoc] -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#hsep"><span class="hs-identifier hs-var">hsep</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">CommandLineOption -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">CommandLineOption
</span><span class="hs-string">&quot;Could not determine the exports of the module&quot;</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ModuleName -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">ModuleName
</span><a href="#local-6989586621681178619"><span class="hs-identifier hs-var">mod_name</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-268"></span><span>        </span><span id="local-6989586621681178597"><span class="annot"><span class="annottext">FindResult
</span><a href="#local-6989586621681178597"><span class="hs-identifier hs-var">err</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; SDoc -&gt; IO (Maybe (Name, ModIface))
forall a. DynFlags -&gt; SDoc -&gt; IO a
</span><a href="GHC.Runtime.Loader.html#throwCmdLineErrorS"><span class="hs-identifier hs-var">throwCmdLineErrorS</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681178598"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">(SDoc -&gt; IO (Maybe (Name, ModIface)))
-&gt; SDoc -&gt; IO (Maybe (Name, ModIface))
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; ModuleName -&gt; FindResult -&gt; SDoc
</span><a href="GHC.Driver.Finder.html#cannotFindModule"><span class="hs-identifier hs-var">cannotFindModule</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681178598"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">ModuleName
</span><a href="#local-6989586621681178619"><span class="hs-identifier hs-var">mod_name</span></a></span><span> </span><span class="annot"><span class="annottext">FindResult
</span><a href="#local-6989586621681178597"><span class="hs-identifier hs-var">err</span></a></span><span>
</span><span id="line-269"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-270"></span><span>    </span><span id="local-6989586621681178598"><span class="annot"><span class="annottext">dflags :: DynFlags
</span><a href="#local-6989586621681178598"><span class="hs-identifier hs-var hs-var">dflags</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HscEnv -&gt; DynFlags
</span><a href="GHC.Driver.Types.html#hsc_dflags"><span class="hs-identifier hs-var hs-var">hsc_dflags</span></a></span><span> </span><span class="annot"><span class="annottext">HscEnv
</span><a href="#local-6989586621681178620"><span class="hs-identifier hs-var">hsc_env</span></a></span><span>
</span><span id="line-271"></span><span>    </span><span id="local-6989586621681178613"><span class="annot"><span class="annottext">doc :: SDoc
</span><a href="#local-6989586621681178613"><span class="hs-identifier hs-var hs-var">doc</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CommandLineOption -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">CommandLineOption
</span><span class="hs-string">&quot;contains a name used in an invocation of lookupRdrNameInModule&quot;</span></span><span>
</span><span id="line-272"></span><span>
</span><span id="line-273"></span><span class="annot"><a href="GHC.Runtime.Loader.html#wrongTyThingError"><span class="hs-identifier hs-type">wrongTyThingError</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Name.html#Name"><span class="hs-identifier hs-type">Name</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Core.TyCo.Rep.html#TyThing"><span class="hs-identifier hs-type">TyThing</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#SDoc"><span class="hs-identifier hs-type">SDoc</span></a></span><span>
</span><span id="line-274"></span><span id="wrongTyThingError"><span class="annot"><span class="annottext">wrongTyThingError :: Name -&gt; TyThing -&gt; SDoc
</span><a href="GHC.Runtime.Loader.html#wrongTyThingError"><span class="hs-identifier hs-var hs-var">wrongTyThingError</span></a></span></span><span> </span><span id="local-6989586621681178596"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681178596"><span class="hs-identifier hs-var">name</span></a></span></span><span> </span><span id="local-6989586621681178595"><span class="annot"><span class="annottext">TyThing
</span><a href="#local-6989586621681178595"><span class="hs-identifier hs-var">got_thing</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[SDoc] -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#hsep"><span class="hs-identifier hs-var">hsep</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">CommandLineOption -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">CommandLineOption
</span><span class="hs-string">&quot;The name&quot;</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Name -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681178596"><span class="hs-identifier hs-var">name</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">PtrString -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ptext"><span class="hs-identifier hs-var">ptext</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CommandLineOption -&gt; PtrString
</span><a href="GHC.Data.FastString.html#sLit"><span class="hs-identifier hs-var">sLit</span></a></span><span> </span><span class="annot"><span class="annottext">CommandLineOption
</span><span class="hs-string">&quot;is not that of a value but rather a&quot;</span></span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">TyThing -&gt; SDoc
</span><a href="GHC.Core.TyCo.Rep.html#pprTyThingCategory"><span class="hs-identifier hs-var">pprTyThingCategory</span></a></span><span> </span><span class="annot"><span class="annottext">TyThing
</span><a href="#local-6989586621681178595"><span class="hs-identifier hs-var">got_thing</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-275"></span><span>
</span><span id="line-276"></span><span class="annot"><a href="GHC.Runtime.Loader.html#missingTyThingError"><span class="hs-identifier hs-type">missingTyThingError</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Types.Name.html#Name"><span class="hs-identifier hs-type">Name</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#SDoc"><span class="hs-identifier hs-type">SDoc</span></a></span><span>
</span><span id="line-277"></span><span id="missingTyThingError"><span class="annot"><span class="annottext">missingTyThingError :: Name -&gt; SDoc
</span><a href="GHC.Runtime.Loader.html#missingTyThingError"><span class="hs-identifier hs-var hs-var">missingTyThingError</span></a></span></span><span> </span><span id="local-6989586621681178592"><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681178592"><span class="hs-identifier hs-var">name</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[SDoc] -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#hsep"><span class="hs-identifier hs-var">hsep</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">CommandLineOption -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">CommandLineOption
</span><span class="hs-string">&quot;The name&quot;</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Name -&gt; SDoc
forall a. Outputable a =&gt; a -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ppr"><span class="hs-identifier hs-var">ppr</span></a></span><span> </span><span class="annot"><span class="annottext">Name
</span><a href="#local-6989586621681178592"><span class="hs-identifier hs-var">name</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">PtrString -&gt; SDoc
</span><a href="GHC.Utils.Outputable.html#ptext"><span class="hs-identifier hs-var">ptext</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">CommandLineOption -&gt; PtrString
</span><a href="GHC.Data.FastString.html#sLit"><span class="hs-identifier hs-var">sLit</span></a></span><span> </span><span class="annot"><span class="annottext">CommandLineOption
</span><span class="hs-string">&quot;is not in the type environment: are you sure it exists?&quot;</span></span><span class="hs-special">)</span><span class="hs-special">]</span><span>
</span><span id="line-278"></span><span>
</span><span id="line-279"></span><span id="local-6989586621681178887"><span class="annot"><a href="GHC.Runtime.Loader.html#throwCmdLineErrorS"><span class="hs-identifier hs-type">throwCmdLineErrorS</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html#DynFlags"><span class="hs-identifier hs-type">DynFlags</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#SDoc"><span class="hs-identifier hs-type">SDoc</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="annot"><a href="#local-6989586621681178887"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-280"></span><span id="throwCmdLineErrorS"><span class="annot"><span class="annottext">throwCmdLineErrorS :: forall a. DynFlags -&gt; SDoc -&gt; IO a
</span><a href="GHC.Runtime.Loader.html#throwCmdLineErrorS"><span class="hs-identifier hs-var hs-var">throwCmdLineErrorS</span></a></span></span><span> </span><span id="local-6989586621681178591"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681178591"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">CommandLineOption -&gt; IO a
forall a. CommandLineOption -&gt; IO a
</span><a href="GHC.Runtime.Loader.html#throwCmdLineError"><span class="hs-identifier hs-var">throwCmdLineError</span></a></span><span> </span><span class="annot"><span class="annottext">(CommandLineOption -&gt; IO a)
-&gt; (SDoc -&gt; CommandLineOption) -&gt; SDoc -&gt; IO a
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; SDoc -&gt; CommandLineOption
</span><a href="GHC.Utils.Outputable.html#showSDoc"><span class="hs-identifier hs-var">showSDoc</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621681178591"><span class="hs-identifier hs-var">dflags</span></a></span><span>
</span><span id="line-281"></span><span>
</span><span id="line-282"></span><span id="local-6989586621681178852"><span class="annot"><a href="GHC.Runtime.Loader.html#throwCmdLineError"><span class="hs-identifier hs-type">throwCmdLineError</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="annot"><a href="#local-6989586621681178852"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-283"></span><span id="throwCmdLineError"><span class="annot"><span class="annottext">throwCmdLineError :: forall a. CommandLineOption -&gt; IO a
</span><a href="GHC.Runtime.Loader.html#throwCmdLineError"><span class="hs-identifier hs-var hs-var">throwCmdLineError</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">GhcException -&gt; IO a
forall a. GhcException -&gt; IO a
</span><a href="GHC.Utils.Panic.html#throwGhcExceptionIO"><span class="hs-identifier hs-var">throwGhcExceptionIO</span></a></span><span> </span><span class="annot"><span class="annottext">(GhcException -&gt; IO a)
-&gt; (CommandLineOption -&gt; GhcException) -&gt; CommandLineOption -&gt; IO a
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">CommandLineOption -&gt; GhcException
</span><a href="GHC.Utils.Panic.html#CmdLineError"><span class="hs-identifier hs-var">CmdLineError</span></a></span><span>
</span><span id="line-284"></span></pre></body></html>